﻿/// <summary>
/// Developer: CHOOI KAH WAI
/// Last Modified: 21/11/2009
/// </summary>

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Microsoft.Win32;
using System.Diagnostics;

namespace ARSS.Editor
{
	/// <summary>
	/// Interaction logic for SceneSettingsWindow.xaml
	/// </summary>
	public partial class SceneSettingsWindow : Window
    {
        #region Functions

        /// <summary>
        /// Constructor
        /// </summary>
        public SceneSettingsWindow()
		{
			this.InitializeComponent();
			
			// Insert code required on object creation below this point.
            Loaded += new RoutedEventHandler(SceneSettingsWindow_Loaded);
		}

        /// <summary>
        /// Window loaded event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SceneSettingsWindow_Loaded(object sender, RoutedEventArgs e)
        {
            LayoutRoot.DataContext = Core.Instance.SceneData;
        }

        /// <summary>
        /// Browse Actions File Path button clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
		private void BrowseActions_Click(object sender, System.Windows.RoutedEventArgs e)
		{
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Filter = "CFG documents |*.cfg";

            Nullable<bool> result = dialog.ShowDialog();

            if (result == true)
            {
                string filePath = dialog.FileName.Substring(
                    System.IO.Path.GetDirectoryName(
                        Process.GetCurrentProcess().MainModule.FileName).Length + 1);

                ActionsFileTextBox.Text = filePath.Replace('\\', '/');
            }
		}

        /// <summary>
        /// Browse Board File Path button clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
		private void BrowseBoardButton_Click(object sender, System.Windows.RoutedEventArgs e)
		{
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Filter = "CFG documents |*.cfg";

            Nullable<bool> result = dialog.ShowDialog();

            if (result == true)
            {
                string filePath = dialog.FileName.Substring(
                    System.IO.Path.GetDirectoryName(
                        Process.GetCurrentProcess().MainModule.FileName).Length + 1);

                BoardFileTextBox.Text = filePath.Replace('\\', '/');
            }
		}

        #endregion
    }
}